home *** CD-ROM | disk | FTP | other *** search
/ PC Users 8 / Cd Pc Users extra 8.iso / prog / inst / firstimp / vcimpres.z / CHSSLink.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-11-07  |  8.0 KB  |  265 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  3. Begin VB.MDIForm MDIForm1 
  4.    BackColor       =   &H8000000C&
  5.    Caption         =   "First Impression/Formula One Link Demo"
  6.    ClientHeight    =   6450
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1785
  9.    ClientWidth     =   9435
  10.    Icon            =   "CHSSLink.frx":0000
  11.    LinkTopic       =   "MDIForm1"
  12.    Begin VB.PictureBox Picture1 
  13.       Align           =   1  'Align Top
  14.       Appearance      =   0  'Flat
  15.       BackColor       =   &H00C0C0C0&
  16.       BeginProperty Font 
  17.          Name            =   "MS Sans Serif"
  18.          Size            =   8.25
  19.          Charset         =   0
  20.          Weight          =   700
  21.          Underline       =   0   'False
  22.          Italic          =   0   'False
  23.          Strikethrough   =   0   'False
  24.       EndProperty
  25.       ForeColor       =   &H80000008&
  26.       Height          =   615
  27.       Left            =   0
  28.       ScaleHeight     =   585
  29.       ScaleWidth      =   9405
  30.       TabIndex        =   0
  31.       Top             =   0
  32.       Width           =   9435
  33.       Begin VB.CommandButton ChartButton 
  34.          Appearance      =   0  'Flat
  35.          BackColor       =   &H00C0C0C0&
  36.          Caption         =   "Update Sheet"
  37.          BeginProperty Font 
  38.             Name            =   "MS Sans Serif"
  39.             Size            =   8.25
  40.             Charset         =   0
  41.             Weight          =   700
  42.             Underline       =   0   'False
  43.             Italic          =   0   'False
  44.             Strikethrough   =   0   'False
  45.          EndProperty
  46.          Height          =   375
  47.          Left            =   7440
  48.          TabIndex        =   3
  49.          Top             =   120
  50.          Visible         =   0   'False
  51.          Width           =   1395
  52.       End
  53.       Begin VB.CheckBox chkChartOnSheet 
  54.          Caption         =   "Place Chart On Sheet"
  55.          BeginProperty Font 
  56.             Name            =   "MS Sans Serif"
  57.             Size            =   8.25
  58.             Charset         =   0
  59.             Weight          =   700
  60.             Underline       =   0   'False
  61.             Italic          =   0   'False
  62.             Strikethrough   =   0   'False
  63.          EndProperty
  64.          Height          =   255
  65.          Left            =   4860
  66.          TabIndex        =   2
  67.          Top             =   300
  68.          Width           =   2475
  69.       End
  70.       Begin VB.CheckBox chkLink 
  71.          Caption         =   "Link Chart To Sheet"
  72.          BeginProperty Font 
  73.             Name            =   "MS Sans Serif"
  74.             Size            =   8.25
  75.             Charset         =   0
  76.             Weight          =   700
  77.             Underline       =   0   'False
  78.             Italic          =   0   'False
  79.             Strikethrough   =   0   'False
  80.          EndProperty
  81.          Height          =   195
  82.          Left            =   4860
  83.          TabIndex        =   1
  84.          Top             =   60
  85.          Width           =   2175
  86.       End
  87.    End
  88.    Begin MSComDlg.CommonDialog CommonDialog1 
  89.       Left            =   60
  90.       Top             =   660
  91.       _ExtentX        =   847
  92.       _ExtentY        =   847
  93.       _Version        =   327680
  94.    End
  95.    Begin VB.Menu mnuFile 
  96.       Caption         =   "&File"
  97.       Begin VB.Menu mnuFileLoadChart 
  98.          Caption         =   "Load &Chart..."
  99.       End
  100.       Begin VB.Menu mnuFileLoadWorkbook 
  101.          Caption         =   "Load &Workbook..."
  102.       End
  103.       Begin VB.Menu FileSep 
  104.          Caption         =   "-"
  105.       End
  106.       Begin VB.Menu FileExit 
  107.          Caption         =   "E&xit"
  108.       End
  109.    End
  110.    Begin VB.Menu mnuChart 
  111.       Caption         =   "&Chart"
  112.       Begin VB.Menu mnuChart2DBar 
  113.          Caption         =   "2D Bar Chart"
  114.       End
  115.       Begin VB.Menu mnuChart3DBar 
  116.          Caption         =   "3D Bar Chart"
  117.       End
  118.       Begin VB.Menu mnuChart2DPie 
  119.          Caption         =   "2D Pie Chart"
  120.       End
  121.       Begin VB.Menu mnuChart3DPie 
  122.          Caption         =   "3D Pie Chart"
  123.       End
  124.    End
  125.    Begin VB.Menu Window 
  126.       Caption         =   "&Window"
  127.       Begin VB.Menu mnuWindowCascade 
  128.          Caption         =   "&Cascade"
  129.       End
  130.       Begin VB.Menu mnuWindowHor 
  131.          Caption         =   "Tile &Horizontal"
  132.       End
  133.       Begin VB.Menu mnuWindowVert 
  134.          Caption         =   "Tile &Vertical"
  135.       End
  136.       Begin VB.Menu mnuWindowIcons 
  137.          Caption         =   "&Arrange Icons"
  138.       End
  139.    End
  140. Attribute VB_Name = "MDIForm1"
  141. Attribute VB_GlobalNameSpace = False
  142. Attribute VB_Creatable = False
  143. Attribute VB_PredeclaredId = True
  144. Attribute VB_Exposed = False
  145. Option Explicit
  146. Private Sub ChartButton_Click()
  147.    ' If there is a chart on the sheet then update the chart
  148.    If chkChartOnSheet.Value = 1 Then
  149.       Call MoveChartPictureToSheet
  150.    End If
  151. End Sub
  152. Private Sub FileExit_Click()
  153.    End
  154. End Sub
  155. Private Sub chkLink_Click()
  156.    If chkLink.Value = 1 Then
  157.       Call ResizeArea
  158.    Else
  159.       ' Disconnect the two
  160.       ChartForm.VtChart1.SsLinkMode = VtChSsLinkModeOff
  161.       
  162.    End If
  163. End Sub
  164. Private Sub MDIForm_Load()
  165.    Top = 0
  166.    Left = 0
  167.    Width = 9615
  168.    Height = 7200
  169.    ChartForm.Show
  170.    SheetForm.Show
  171.    Arrange 2
  172.    GlobalObjID = 0
  173.    ChartOnSheet = False
  174. End Sub
  175. Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  176.    End
  177. End Sub
  178. Private Sub mnuChart2DBar_Click()
  179.    ChartForm.VtChart1.chartType = VtChChartType2dBar
  180.    Call ClearChartMenuChecks
  181.    mnuChart2DBar.Checked = True
  182. End Sub
  183. Private Sub mnuChart2DPie_Click()
  184.    ChartForm.VtChart1.chartType = VtChChartType2dPie
  185.    Call ClearChartMenuChecks
  186.    mnuChart2DPie.Checked = True
  187. End Sub
  188. Private Sub mnuChart3DBar_Click()
  189.    ChartForm.VtChart1.chartType = VtChChartType3dBar
  190.    Call ClearChartMenuChecks
  191.    mnuChart3DBar.Checked = True
  192. End Sub
  193. Private Sub mnuChart3DPie_Click()
  194.    ChartForm.VtChart1.chartType = VtChChartType3dPie
  195.    Call ClearChartMenuChecks
  196.    mnuChart3DPie.Checked = True
  197. End Sub
  198. Private Sub mnuFileLoadChart_Click()
  199.    On Error GoTo FIFileLoadError
  200.    With CommonDialog1
  201.       .DialogTitle = "Read First Impression Chart"
  202.       .DefaultExt = "vtc"
  203.       .Filter = "FirstImpression Charts |*.vtc"
  204.       .Flags = &H1000
  205.       .InitDir = App.Path
  206.       .ShowOpen
  207.       ChartForm.VtChart1.ReadFromFile (.fileName)
  208.    End With
  209.    Exit Sub
  210. FIFileLoadError:
  211.    MsgBox Error
  212. End Sub
  213. Private Sub mnuFileLoadWorkbook_Click()
  214.    On Error GoTo F1FileLoadError
  215.    Dim fileName As String, filetype As Integer
  216.    SheetForm.F1Book1.OpenFileDlg "Formula One Link Demo", hWnd, fileName
  217.    SheetForm.F1Book1.Read fileName, filetype
  218.    SheetForm.F1Book1.TableName = fileName
  219.    Exit Sub
  220. F1FileLoadError:
  221.    MsgBox Error
  222. End Sub
  223. Private Sub mnuWindowCascade_Click()
  224.    Arrange 0
  225. End Sub
  226. Private Sub mnuWindowHor_Click()
  227.    Arrange 1
  228. End Sub
  229. Private Sub mnuWindowIcons_Click()
  230.    Arrange 3
  231. End Sub
  232. Private Sub mnuWindowVert_Click()
  233.    Arrange 2
  234. End Sub
  235. Private Sub chkChartOnSheet_Click()
  236. #If Win32 Then
  237.    Dim metafile&
  238. #Else
  239.    Dim metafile%
  240. #End If
  241.    Dim MapMode%, ObjID&
  242.    Dim X1!, Y1!, X2!, Y2!
  243.    Dim ExtentX&, ExtentY&
  244.    ChartButton.Visible = chkChartOnSheet.Value
  245.    If chkChartOnSheet.Value = 1 Then
  246.       ' Cell coordinates of where to put the chart
  247.       X1 = 1
  248.       Y1 = 6
  249.       X2 = 5
  250.       Y2 = 18
  251.       MapMode = 8 ' Anisotropic Mode (Stretchable)
  252.       ' Get the metafile from the chart
  253.       ChartForm.VtChart1.GetMetafile VtPictureOptionNoSizeHeader, metafile, ExtentX, ExtentY
  254.       ' Place it on the spreadsheet
  255.       SheetForm.F1Book1.ObjNewPicture X1, Y1, X2, Y2, ObjID, metafile, MapMode, ExtentX, ExtentY
  256.       GlobalObjID = ObjID
  257.       ChartOnSheet = True
  258.    Else
  259.       ' Delete the chart metafile object
  260.       SheetForm.F1Book1.ObjSetSelection GlobalObjID
  261.       SheetForm.F1Book1.EditCut
  262.       ChartOnSheet = False
  263.    End If
  264. End Sub
  265.